<?php

namespace XWAM\Addon\POrgDocument\Controller;

/**
 * ChannelsLinkController类
 *
 * @since 1.0 <2015-10-26> SoChishun <14507247@qq.com> Added.
 */
class ChannelsLinkController extends AddonbaseController {

    public function link_edit($id = 0) {
        if (!$id) {
            $this->error('参数有误!');
        }
        $data = AddonD('DocumentCategoryLink')->find($id);
        if (!$data) {
            $data['category_id'] = $id;
            $data['action'] = 'add';
        }
        $this->assign('data', $data);
        $this->display();
    }

    public function link_edit_save() {
        $result = AddonD('DocumentCategoryLink')->save_link();
        if ($result['status']) {
            $this->success('保存成功');
        } else {
            $this->error(implode('<br />', $result['info']));
        }
    }

}
